#include "Cheats.h"

Cheats g_pCheats;


void Cheats::Init()
{
	this->Active = true;
	this->NoSky = true;
	this->Asus = false;
	this->SkyboxPtr = (DWORD*) ((DWORD)GetModuleHandleA(/*client.dll*/XorStr(10, 0x64, 0x078F0B84, 0x0EAB70B9, 0x30B70000).c_str()) + 0x576878); //0x2A443E28); // TODO SEARCHPATTERN!
	this->ClearPtr = (DWORD*) ((DWORD)GetModuleHandleA(/*client.dll*/XorStr(10, 0x64, 0x078F0B84, 0x0EAB70B9, 0x30B70000).c_str()) + 0x573E28);  //0x2A446878); // TODO SEARCHPATTERN!
}

void Cheats::Enable()
{
	this->Active = true;
}

void Cheats::Disable()
{
	this->Active = false;
}

void Cheats::Set( bool Active )
{
	this->Active = Active;
}

void Cheats::SetNoSky( bool Active )
{
	this->NoSky = Active;
}

void Cheats::SetAsus( bool Active )
{
	this->Asus = Active;
}

void Cheats::Compute()
{
	if (Active)
	{
		if (NoSky)
		{
			*SkyboxPtr = 0;
			*ClearPtr = 1;
		}
		else
		{
			*SkyboxPtr = 1;
			*ClearPtr = 0;
		}
	}
	else
	{
		*SkyboxPtr = 1;
		*ClearPtr = 0;
	}
}

void Cheats::ComputeAsus( IMaterial* Mat )
{
	if (Asus)
	{
		Mat->AlphaModulate(0.5f);
	}
}
